//
//  CLReadCatalogCell.m
//  CLBrowser
//
//  Created by 梁慧聪 on 2022/7/18.
//

#import "CLReadCatalogCell.h"
@interface CLReadCatalogCell()

@end

@implementation CLReadCatalogCell


+ (CLReadCatalogCell *)cell:(UITableView *)tableView  {
    
    CLReadCatalogCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CLReadCatalogCell"];
    
    if (cell == nil) {
        cell = [[CLReadCatalogCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"CLReadCatalogCell"];
    }

    return cell;
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = UIColor.clearColor;
        [self addSubviews];
    }
    return self;
}

- (void)addSubviews {
    
    self.chapterName = [[UILabel alloc]init];
    self.chapterName.font = CL_FONT_SA_14;
    self.chapterName.textColor = UIColor.blackColor;
    [self.contentView addSubview:self.chapterName];
    
    self.spaceLine = SpaceLine(self.contentView, UIColor.lightGrayColor);
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    CGFloat w = self.frame.size.width;
    CGFloat h = self.frame.size.height;
    
    self.chapterName.frame = CGRectMake(CL_SIZE(CL_SPACE_15), 0, w - CL_SIZE(CL_SPACE_30), h);
    
    self.spaceLine.frame = CGRectMake(CL_SIZE(CL_SPACE_15), h - CL_SPACE_LINE,  w - CL_SIZE(CL_SPACE_30), CL_SPACE_LINE);
}

@end
